/*
 * To change this template, choose Tools | Templates and open the template in
 * the editor.
 */
package eikotrade.javafx.controlls;

import eikotrade.javafx.backendfacades.TestFacade;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;

/**
 *
 * @author michel
 */
public class StoreButton extends EikoTradeButton{

    public StoreButton(String label, Object objectToStore) {
        super(label);
        setOnAction(buildEventHanlder(objectToStore));
    }
    
    private EventHandler buildEventHanlder(final Object objectToStore){
        return new EventHandler<ActionEvent>() {

            public void handle(ActionEvent event) {
                TestFacade.storeObject(objectToStore);
            }
        };
    }
    
}
